<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>AngularJS&middot;Hello AngularJS</title>
    <link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.2/css/bootstrap.css">
    <style>
        .demo{
            margin-bottom:10px;
            border-bottom:1px solid #1b926c;
        }
    </style>
</head>
<body ng-app="MyAPP">
 <div class="container">
     <div class="row">
         <nav class="navbar navbar-default navbar-static-top">
             <div class="container-fluid">
                 <div class="navbar-header">
                     <a class="navbar-brand" href="../index.html">首页</a>
                 </div>
                 <ul class="nav navbar-nav">
                    <li class="active"><a href="javascript:void(0)">Link</a></li>
                    <li><a href="javascript:void(0)">Link2</a></li>
                 </ul>
             </div>
         </nav>
     </div>
     <h3>ng-include示例</h3>
     <div class="row text-center demo" ng-controller="MyController">
         <div ng-include src="'tpl_header.html'"></div>
         <article style="min-height:300px;padding:20px;">
             如果你是一个angular的开发者的话，对于ng-html2js你应该 很熟悉。对于angular的指令，我们经常需要定义模板( directive template/templateUrl),你可以选择讲html page 放在真正的的web容器中寄宿，也可以选择angular的ng-template 放在view的page之上，抑或也可以讲html打成一个js文件和directive 的js文件合并在一起发布。
         </article>
         <div ng-include src="'tpl_footer.html'"></div>
     </div>
 </div>
 </div>
</body>
</html>
<script src="http://cdn.bootcss.com/angular.js/1.3.8/angular.js" type="text/javascript"></script>
<script type="text/ng-template" id="tpl_header.html">
    <header class="row" style="padding:10px;background:darkolivegreen;">
        <h3>{{headerTitle}}</h3>
        <p><input type="text" ng-model="name"></p>
        <p>{{name}}</p>
        <button ng-click="show()">点我</button>
    </header>
</script>
<script type="text/ng-template" id="tpl_footer.html">
    <footer class="row" style="padding:30px;background:#999;color:red;">
        <h2>{{footerTitle}}</h2>
        <p><input type="text" ng-model="name"></p>
        <p>{{name}}</p>
        <button ng-click="show()">点我</button>
    </footer>
</script>
<script>
    var app=angular.module("MyAPP",[]);
    app.controller("MyController",function($scope){
        $scope.headerTitle="我是网页顶部标题";
        $scope.footerTitle="我是页脚标题";
        $scope.name="hello";

        $scope.show=function(){
            alert($scope.name);
        }

    });
</script>